package com.itlong.cloud.user.property;

import com.itlong.cloud.POJO.DTO.property.PropertyGroupGetPageDTO;
import com.itlong.cloud.POJO.PO.PropertyGroupPO;
import com.itlong.cloud.utils.page.Page;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;


/**
 * <desc>
 *      物业-部门业务处理暴露接口
 * </desc>
 *
 * @createDate 2017/10/17
 */
@FeignClient(name = "user-service")
public interface IPropertyGroupServiceClient {

    /**
     * <desc>
     *      获取分页列表
     * </desc>
     *
     * @return page
     * @author Biao.R
     * @createDate 2017/10/17
     */
    @RequestMapping(path = "/property/system/group/getPage")
    Page<PropertyGroupPO> getPage(PropertyGroupGetPageDTO pageDTO) throws Exception;



    /**
     * <desc>
     *      保存部门
     * </desc>
     *
     * @param propertyGroupPO
     * @return
     * @author Biao.R
     * @createDate 2017/10/17
     */
    @RequestMapping(path = "/property/system/group/save")
    Integer save(@RequestBody PropertyGroupPO propertyGroupPO) throws Exception;



    /**
     * <desc>
     *      更新部门
     * </desc>
     *
     * @param propertyGroupPO
     * @return
     * @author Biao.R
     * @createDate 2017/10/17
     */
    @RequestMapping(path = "/property/system/group/updateGroup")
    Integer update(@RequestBody PropertyGroupPO propertyGroupPO) throws Exception;

    /**
     * <desc>
     *      根据id查询部门
     * </desc>
     *
     * @param propertyGroupPO 部门实体
     * @return
     * @author Biao.R
     * @createDate 2017/10/17
     */
    @RequestMapping(path = "/property/system/group/getOne")
    public PropertyGroupPO getOne(@RequestBody PropertyGroupPO propertyGroupPO);

    /**
     * <desc>
     *      禁用或启用部门
     * </desc>
     *
     * @param propertyGroupPO 部门实体
     * @return
     * @author Biao.R
     * @createDate 2017/10/17
     */
    @RequestMapping(path = "/property/system/group/banOrUse")
    public Integer banOrUse(@RequestBody PropertyGroupPO propertyGroupPO) throws Exception;

    /**
     * <desc>
     *       部门分配人员
     * </desc>
     *
     * @param groupId    部门id
     * @param allotUsers    需要分配的人员id 多个，号分隔
     * @param userIds 当前列表所有人员id 多个，号分隔
     * @return sql执行行数
     * @author Biao.R
     * @createDate 2017/10/17
     */
    @RequestMapping(path = "/property/system/group/saveGroupUsers")
    Integer saveGroupUsers(
            @RequestParam("groupId") String groupId,
            @RequestParam("allotUsers") String allotUsers,
            @RequestParam("userIds") String userIds);

    /**
     * <desc>
     *      根据字段查询部门
     * <desc/>
     * @param   params  查询参数
     * @return List<PropertyGroupPO>    返回对象集合
     * @author Biao.R
     * @createDate 2017/10/18
     */
    @PostMapping(path = "/property/system/group/getByFeilds")
    List<PropertyGroupPO> getByFeilds(@RequestBody Map<String, Object> params);
}
